﻿using UnityEngine;

public class GameMaster : MonoBehaviour
{
    public GameObject[] GameObjects;
    public string[] ObjectNames;

    private void Update()
    {
        for (int i = 0; i < this.ObjectNames.Length; i++)
        {
            string o = this.ObjectNames[i];
            GameObject temp = GameObject.Find(o);
            if (temp == null)
            {
                temp = (GameObject)Instantiate(this.GameObjects[i]);
                temp.name = o;
                if (o == "EventManager")
                    DontDestroyOnLoad(temp);
            }
        }
    }
}